//
//  DetailMVTableViewCell.m
//  wind
//
//  Created by dllo on 16/1/14.
//  Copyright © 2016年 李金明. All rights reserved.
//

#import "DetailMVTableViewCell.h"

@interface DetailMVTableViewCell ()

@property (nonatomic, retain) UIButton *downLoadBtn;
@property (nonatomic, retain) UIButton *shareBtn;

@end

@implementation DetailMVTableViewCell

- (void)dealloc
{
    [_videoName release];
    [_singerName release];
    [_downLoadBtn release];
    [_shareBtn release];
    [super dealloc];
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createViews];
    }
    return self;
}

- (void)createViews
{
//    self.backgroundColor = [UIColor yellowColor];
    
    self.videoName = [[UILabel alloc] init];
//    self.videoName.backgroundColor = [UIColor blueColor];
    self.videoName.textAlignment = NSTextAlignmentCenter;
    
    [self addSubview:self.videoName];
    [_videoName release];
    
    self.singerName = [[UILabel alloc] init];
//    self.singerName.backgroundColor = [UIColor redColor];
    self.singerName.textAlignment = NSTextAlignmentCenter;
    [self addSubview:self.singerName];
    [_singerName release];
    
//    self.downLoadBtn = [UIButton buttonWithType:UIButtonTypeCustom];
//    [self.downLoadBtn setImage:[UIImage imageNamed:@"iconfont-mvxiazai"] forState:UIControlStateNormal];
//    [self.downLoadBtn addTarget:self action:@selector(downloadAction) forControlEvents:UIControlEventTouchUpInside];
//    [self addSubview:self.downLoadBtn];
    
    self.shareBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    [self.shareBtn setImage:[UIImage imageNamed:@"iconfont-fenxiang"] forState:UIControlStateNormal];
    [self.shareBtn addTarget:self action:@selector(shareAction) forControlEvents:UIControlEventTouchUpInside];
    [self addSubview:self.shareBtn];
    
    
}

- (void)shareAction
{
    NSLog(@"分享");
    [self.delegate shareMV];
}

- (void)layoutSubviews
{
    self.videoName.frame = CGRectMake(10, 10, SCREEN_WIDTH - 20, self.bounds.size.height / 3.5);
    self.singerName.frame = CGRectMake(10, 10 + (self.videoName.frame.size.height), SCREEN_WIDTH - 20, self.bounds.size.height / 3.5);
//    self.downLoadBtn.frame = CGRectMake(30, self.singerName.frame.size.height + self.singerName.frame.origin.y + 20, 40, 40);
//    [self.shareBtn mas_makeConstraints:^(MASConstraintMaker *make) {
//        
//        make.right.equalTo(self.mas_right).with.offset(-30);
//        make.top.equalTo(self.downLoadBtn);
//        make.width.equalTo(self.downLoadBtn);
//        make.height.equalTo(self.downLoadBtn);
//        
//    }];
    self.shareBtn.frame = CGRectMake((self.bounds.size.width / 2) - 25 , self.singerName.frame.size.height + self.singerName.frame.origin.y + 20, 50, 50);
    
}

@end
